/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utility;

import java.util.List;

/**
 *
 * @author Yusup Jauhari Shandi <in.visi>
 * STring LIst mun di delphi mah, buat nampung name vs value nya
 */
public class NameValueList {
    private String key;
    private String value;

    public NameValueList() {
    }

    
    public NameValueList(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
    
    public static int indexOf(List<NameValueList> list, String key) {
        for (int i=0; list.size() > i; i++) {
            NameValueList nameValueList = (NameValueList) list.get(i);
            if (nameValueList.getKey().equals(key)) {
                return i;
            }
        }
        return -1;
    }
    
    @Override
    public String toString(){
        return value;
    }
}
